Skip to content

Show error message in Aspire panel when CLI does not support describe#15181

Merged
adamint merged 2 commits intomicrosoft:release/13.2from
adamint:adamint/unsupported-cli-message
Mar 12, 2026
Merged

Show error message in Aspire panel when CLI does not support describe#15181
adamint merged 2 commits intomicrosoft:release/13.2from
adamint:adamint/unsupported-cli-message

Conversation

@adamint
Copy link
Copy Markdown
Member

@adamint adamint commented Mar 12, 2026

Description

When aspire describe --follow exits without producing valid NDJSON data (e.g., because the installed Aspire CLI is too old and doesn't support the describe command), the extension now shows the existing errorWelcome view in the Aspire panel. This informs the user that their CLI version doesn't support this feature and provides buttons to update the CLI or refresh.

Previously, the exit callback would silently retry with exponential backoff forever, never surfacing the error to the user.

Changes

  • AppHostDataRepository.ts: Added a _describeReceivedData flag that tracks whether the describe process ever produced valid data. On exit:
    • If no data was received → set error state (triggers errorWelcome view)
    • If data was received → clear error and retry with backoff (existing behavior)
    • On refresh() → clear error state immediately so the error page dismisses before re-attempting
  • package.nls.json: Updated error message to mention restarting VS Code after updating the CLI.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

When 'aspire describe --follow' exits without producing valid data, show
the errorWelcome view informing the user that the CLI version doesn't
support this feature and needs updating.

- Track whether describe ever received valid NDJSON data
- If process exits without data, set error state to show errorWelcome
- If process exits after receiving data, retry with backoff as before
- Clear error state on refresh so the error page dismisses immediately
Copilot AI review requested due to automatic review settings March 12, 2026 18:29
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 12, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15181

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15181"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Aspire VS Code extension’s workspace resource watcher (aspire describe --follow) to surface a user-facing error state in the Aspire panel when the command exits without producing valid NDJSON (e.g., older CLI that doesn’t support describe), instead of silently retrying forever.

Changes:

  • Track whether aspire describe --follow ever produced valid resource data and use that to decide between showing an error vs. restarting with backoff.
  • Clear the panel error state immediately on refresh() so the error welcome view dismisses before re-attempting.
  • Update the Aspire panel error welcome text to mention restarting VS Code after updating the CLI.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
extension/src/views/AppHostDataRepository.ts Adds _describeReceivedData and changes describe-exit handling to show an error welcome when no valid NDJSON is ever observed.
extension/package.nls.json Updates the error welcome string to include “restart VS Code” guidance.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +273 to +279
if (!this._describeReceivedData) {
// The process exited without ever producing valid data.
// This likely means the CLI does not support the describe command.
extensionLogOutputChannel.warn('aspire describe --follow exited without producing data; the installed Aspire CLI may not support this feature.');
this._setError(errorFetchingAppHosts(`exit code ${code}`));
this._updateWorkspaceContext();
} else {
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In aspire describe --follow, the CLI intentionally returns exit code 0 when no AppHost is running (it prints an informational message and exits). With the new logic, that case will still have _describeReceivedData === false, so the extension will set aspire.fetchAppHostsError and show the error welcome even though this is a normal “no running apphosts” scenario. Consider only treating "no data" as an error when the process exits non-zero (and keep the previous backoff/retry + clear-error behavior for code 0). Also, when setting the error state, clear _workspaceResources so the viewsWelcome error page is guaranteed to display (it won’t show if the tree has existing items).

Copilot uses AI. Check for mistakes.
"views.runningAppHosts.name": "Running AppHosts",
"views.runningAppHosts.welcome": "No running Aspire apphost detected in this workspace.\n[Refresh](command:aspire-vscode.refreshRunningAppHosts)",
"views.runningAppHosts.errorWelcome": "The Aspire CLI is not installed or does not support this feature. Install or update the Aspire CLI to get started.\n[Update Aspire CLI](command:aspire-vscode.updateSelf)\n[Refresh](command:aspire-vscode.refreshRunningAppHosts)",
"views.runningAppHosts.errorWelcome": "The Aspire CLI is not installed or does not support this feature. Install or update the Aspire CLI and restart VS Code to get started.\n[Update Aspire CLI](command:aspire-vscode.updateSelf)\n[Refresh](command:aspire-vscode.refreshRunningAppHosts)",
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string was updated in package.nls.json, but the checked-in localization source XLF (extension/loc/xlf/aspire-vscode.xlf) is generated from package.nls.json (see gulpfile.js export task) and will be out of sync until it’s regenerated. Please re-run the l10n export/generation step and include the updated XLF so localization tooling and translators pick up the new source text.

Copilot uses AI. Check for mistakes.
…ate XLF

- Only treat 'no data received' as an error when exit code is non-zero;
  exit code 0 with no data means no AppHost is running (normal scenario).
- Clear _workspaceResources when setting error so the errorWelcome page
  is guaranteed to display.
- Regenerate aspire-vscode.xlf to reflect updated package.nls.json.
@adamint adamint merged commit d3ae792 into microsoft:release/13.2 Mar 12, 2026
255 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants